//
//  picPickerCollectionViewCell.swift
//  WB
//
//  Created by leador on 17/5/15.
//  Copyright © 2017年 袁满. All rights reserved.
//

import UIKit

class picPickerCollectionViewCell: UICollectionViewCell {
    
    var photoImage:UIImage? {
        
        didSet {
            
            if photoImage != nil {
                imageView.isHidden = false
                imageView.image = photoImage
                photoBtn.isHidden = true
                deletePhotoBtn.isHidden = false
            }else {
                imageView.isHidden = true
                photoBtn.isHidden = false
                deletePhotoBtn.isHidden = true
            }
            
        }
        
    }
    
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var photoBtn: UIButton!
    @IBOutlet weak var deletePhotoBtn: UIButton!

    @IBAction func addPhotoClick(_ sender: Any) {
        
        NotificationCenter.default.post(name: Notification.Name(rawValue: addPhotoNotification), object: nil)
        
    }
    
    @IBAction func delePhotoClick(_ sender: Any) {
     
         NotificationCenter.default.post(name: Notification.Name(rawValue: deletePhotoNotification), object: imageView.image)
    
    }
    

}
